package views;

import com.grupp42.te.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;

/**
 * Start menu gui class
 * @author Simon, Christian
 * 
 */

public class GUI extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {

		super.onCreate(savedInstanceState);
		
		/*Sets the view to the main layout*/
	    setContentView(R.layout.main);

	    GridView gridview = (GridView) findViewById(R.id.mainmenu);
	    gridview.setAdapter(new ImageAdapter(this));

	    /*Listener for the icons in the main menu.*/
	    gridview.setOnItemClickListener(new OnItemClickListener() {
	       

			public void onItemClick(AdapterView<?> parent, View v, int position,
					long id) {
				Toast.makeText(GUI.this, "" + position, Toast.LENGTH_SHORT).show();
				setResult(10 + position);
				finish();
				
			}
	    });
	}

	@Override
	protected void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
	}

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
		super.onResume();
	}
	
	

}
